#include <iostream>
using std::cout;
using std::endl;


//Point类只是为了给Line类服务
//就可以将Point类定义成Line类的内部类
class Line
{
/* public: */
    //也可以称Point是Line的成员类型
    class Point
    {
    public:
        Point(int x,int y)
            : _ix(x)
              , _iy(y)
        {
            cout << "Point(int,int)" << endl;
        }

        ~Point(){
            cout << "~Point()" << endl;
        }


        void print(){
            cout << "(" << _ix
                << "," << _iy
                << ")";
        }
    private:
        int _ix;
        int _iy;
    };

public:
    Line(int x1,int y1,int x2,int y2)
        : _pt1(x1,y1)
          , _pt2(x2,y2)
    {
        cout << "Line(int*4)" << endl;
    }

    ~Line(){
        cout << "~Line()" << endl;
    }

    void printLine(){
        _pt1.print();
        cout << "----->";
        _pt2.print();
        cout << endl;
    }
private:
    Point _pt1;
    Point _pt2;
};

void test0(){
    /* Line::Point pt(2,8); */

    cout << sizeof(Line) << endl;
    Line ll(1,2,3,4);
    ll.printLine();
}

int main(void){
    test0();
    return 0;
}
